require File.dirname(__FILE__) + '/../base'
require File.dirname(__FILE__) + '/ujs_helper'

module SimpleUjs
  module Helpers
    module TagHelper
      include SimpleUjs::Helpers::UjsHelper
      
      def tag(name, options = nil, open = false)
        options = options.stringify_keys if options
        convert_options_to_ujs(options, 
                               :keep_method => (name.to_s == "form") ? true : false) if options and should_use_ujs?
        super
      end
      
      def content_tag(name, content_or_options_with_block = nil, options = nil, &block)
        if block_given?
          options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
        end
        if options
          options = options.stringify_keys 
          convert_options_to_ujs(options) if should_use_ujs? 
        end
        
        super
      end
      
    end
  end
end